package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {
    private ImageButton button;
    private Button btn1;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        button =findViewById(R.id.button);
        btn1 =findViewById(R.id.button1);
        btn1.setOnClickListener(this);
        button.setOnClickListener(view -> Toast.makeText(getApplicationContext(),"按钮点击",Toast.LENGTH_SHORT).show());

    }

    @Override
    public void onClick(View view){
        Toast.makeText(this,"按钮点击",Toast.LENGTH_SHORT).show();
    }



    public void Click(View view) {
        Toast.makeText(this,"按钮点击",Toast.LENGTH_SHORT).show();
    }

    public void floatClick(View view) {
        Toast.makeText(this,"浮动按钮点击",Toast.LENGTH_SHORT).show();
    }
}